import unittest, threading

import time


def test_task(name):
    print(f"{threading.current_thread().name}:", name)
    time.sleep(1)


class TestTask(unittest.TestCase):
    def test01(self):
        test_task(1)

    def test02(self):
        test_task(2)

    def test03(self):
        test_task(3)

    def test04(self):
        test_task(4)

    def test05(self):
        test_task(5)

    def test06(self):
        test_task(6)

    def test07(self):
        test_task(7)

    def test08(self):
        test_task(8)

    def test09(self):
        test_task(9)

    def test10(self):
        test_task(10)






class MyThread(threading.Thread):
    def __init__(self, thread_name):
        super(MyThread, self).__init__(name=thread_name)

    def run(self):
        TestTask(self.name)
        print("%s正在运行的线程......" % self.name)


if __name__ == '__main__':
    for i in range(10):
        temp = threading.Thread(name="thread " + str(i))
        temp.start()
    print(threading.current_thread().name)

    # for i in range(10):
    #     MyThread("thread-" + str(i)).start()
